package com.itheima.common;

/**
 * 创建一个线程工具类将 用户id动态获取到存入线程中
 */
public class BaseContext {
    private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    //get方法获取 线程数据
    public static Long getId() {
        Long id = threadLocal.get();
        return id;
    }

    //set方法设置线程的数据
    public static void setId(Long id) {
        threadLocal.set(id);
    }

}
